home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Frameworks / TransSkel 3.24 / Source / Dialog Item Stuff / SkelSetDlogCursor.c < prev    next >
Text File  |  1996-01-17  |  764b  |  40 lines

  1. /*
  2.  * Set cursor to I-beam if it's in an edit text item of the given dialog.
  3.  *
  4.  * Does nothing if the FindDItem() trap doesn't exist (which it doesn't in
  5.  * versions of system software prior to 3.2).
  6.  */
  7.  
  8. # include    <Traps.h>
  9.  
  10. # include    "TransSkel.h"
  11.  
  12.  
  13.  
  14. pascal void
  15. SkelSetDlogCursor (DialogPtr d)
  16. {
  17. GrafPtr    savePort;
  18. Point    pt;
  19. short    i;
  20.  
  21.     if (SkelTrapAvailable (_FindDItem))
  22.     {
  23.         /*
  24.          * Get cursor local coordinates.  One assumes the port will be set
  25.          * to the dialog, but you never know...
  26.          */
  27.         GetPort (&savePort);
  28.         SetPort (d);
  29.         GetMouse (&pt);
  30.         SetPort (savePort);
  31.         i = FindDialogItem (d, pt) + 1;
  32.         if (i > 0 && (SkelGetDlogType (d, i) & editText) == 0)
  33.                 i = 0;
  34.         if (i > 0)
  35.             SetCursor (*GetCursor (iBeamCursor));
  36.         else
  37.             InitCursor ();
  38.     }
  39. }
  40.